#include<iostream>
#include<pthread.h>
#include<unistd.h>
using namespace std;

void* newthreadrun(void* arg)
{
    while(true)
    {
        cout<<"I am new thread,pid:"<<getpid()<<",pthread id:"<<pthread_self()<<endl;
        sleep(1);
    }
}

int main()
{
    pthread_t tid;
    pthread_create(&tid,nullptr,newthreadrun,nullptr);
    while(true)
    {
        cout<<"I am main thread,pid:"<<getpid()<<",pthread id:"<<pthread_self()<<endl;
        sleep(1);
    }
    return 0;
}